<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <script src="__STATIC__/js/base.js"></script>
    <title>忘记密码</title>
    <link rel="stylesheet" href="__STATIC__/css/base.css">
    <link rel="stylesheet" href="__STATIC__/css/login.css">
    <script src="__STATIC__/js/jquery-1.11.1.min.js"></script>
    <link rel="stylesheet" href="__STATIC__/js/layer_mobile/need/layer.css">
    <script src="__STATIC__/js/form_validation.js"></script>
    <script src="__STATIC__/js/layer_mobile/layer.js"></script>
</head>
<body>
<section class="wrap">
    <div id="login-form">
        <form    id="form1"   onsubmit="return searchSub() ">
            <div id="form-title">企业宝</div>
            <div class="form-content ">
                <div class="clearfix input-inline">
                    <div class="formtitle pull-left"><img src="__STATIC__/images/phone-img.png"></div>
                    <div class="formcontent pull-left">
                        <input tabindex="1" id="phone_number" class="inputstyle1" autocomplete="off"  maxlength="15" type="text" name="mobile" placeholder="请输入手机号"/>
                    </div>
                </div>
            </div>
            <div class="form-content ">
                <div class="clearfix input-inline" style="position: relative">
                    <div class="formtitle pull-left"><img src="__STATIC__/images/capche.png"></div>
                    <div class="formcontent pull-left">
                        <input tabindex="1" id="code" class="inputstyle1" style="width:9rem " autocomplete="off"  maxlength="15" type="text" name="smsCode" placeholder="请输入验证码"/>
                    </div>
                    <input type="button" class="getCapche"  value="发送验证码" id="verification_code" onclick="sendCapche()" >
                </div>
            </div>
            <div class="form-content ">
                <div class="clearfix input-inline">
                    <div class="formtitle pull-left"><img src="__STATIC__/images/pwd-first.png"></div>
                    <div class="formcontent pull-left">
                        <input tabindex="2" id="pwd"   type="password" name="loginPwd" placeholder="请输入6-32位由数字和字母组成的密码"/>
                    </div>
                </div>
            </div>
            <div class="form-content ">
                <div class="clearfix input-inline">
                    <div class="formtitle pull-left"><img src="__STATIC__/images/pwd-img.png"></div>
                    <div class="formcontent pull-left">
                        <input tabindex="2" id="confirm_pwd" type="password"  placeholder="请再次输入密码"/>
                    </div>
                </div>
            </div>
            <!--<div class="login-orther clearfix">-->
                <!--<div class="pull-right"><a href="findpwd2.html" >收不到验证码？</a></div>-->
            <!--</div>-->
            <input type="button" class="login-button"  value="确认" id="sublimit">
        </form>
    </div>
</section>
</body>
<script>
    function sendCapche(){
        var phone = $('#phone_number').val();
        if(phone ==''){
            layer.open({
                content:'请先填写手机号'
                ,skin: 'msg'
                ,time:3 //2秒后自动关闭
            });
            return false;
        }
        var formData = {sms_code:"SMS_79080049",phone:phone};
        $.ajax({
            url : "findPwdCheckMobile",
            type: "POST",
            data : formData,
            success: function(data)
            {
                //data - response from server
                if(data.code != 'OK'){
                    layer.open({
                        content:data.msg
                        ,skin: 'msg'
                        ,time:3 //2秒后自动关闭
                    });
                }else {
                    layer.open({
                        content:'发送成功'
                        ,skin: 'msg'
                        ,time:3 //2秒后自动关闭
                    });
                }
            },
            error: function (jqXHR)
            {
                layer.open({
                    content:'发送失败'
                    ,skin: 'msg'
                    ,time:3 //2秒后自动关闭
                });
            }
        });
        var obj = $("#verification_code");
        settime(obj);
    }
    $(function(){
        $('#sublimit').on('click',function(){
            var  res = searchSub();
            if(res =='ok'){
                //提交
                $.ajax({
                    cache: true,
                    type: "POST",
                    url:"findpwd",
                    data:$('#form1').serialize(),// 你的formid
                    async: false,
                    error: function(request) {
                        layer.open({
                            content:'提交失败'
                            ,skin: 'msg'
                            ,time:3 //2秒后自动关闭
                        });
                    },
                    success: function(data) {
                        if(data.code =='ok'){
                            //连接不对
                            window.location.href='/index.html';
                        }else {
                            layer.open({
                                content:data.msg
                                ,skin: 'msg'
                                ,time:3 //2秒后自动关闭
                            });
                        }
                    }
                });
            }else{
                //提示
                layer.open({
                    content:res
                    ,skin: 'msg'
                    ,time:3 //2秒后自动关闭
                });
            }
        });
    });
</script>
</html>